package com.gudong.model.data;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.Getter;
import lombok.NoArgsConstructor;


/**
 * 分页请求
 *
 * @author Eathon
 */
@AllArgsConstructor
@NoArgsConstructor
@Data
public class PageRequest {


    private Integer currentPage = 1;


    private Integer pageSize = 20;


    public PageRequest(Integer pageNum, Integer pageSize) {
        this.currentPage = pageNum;
        this.pageSize = pageSize;
    }

    @Getter
    private String orderBy;

    /**
     * 分页对象
     */
    public Page<Object> toPage() {
        return new Page<>(currentPage, pageSize, true);
    }
}
